package com.ce.pms.common.service.impl;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.ce.pms.base.service.impl.PmsBaseServiceImpl;
import com.ce.pms.common.dao.IComLog4ceBizLogInfoDao;
import com.ce.pms.common.model.ComLog4ceBizLogInfoDomain;
import com.ce.pms.common.model.HmEmployeeDomain;
import com.ce.pms.common.service.IComLog4ceBizLogInfoService;
import com.ce.pms.common.vo.ComLog4ceBizLogInfoVO;
import com.ce.pms.common.vo.OrganizationalStructureVO;
import com.sitechasia.webx.core.support.Page;

public class ComLog4ceBizLogInfoServiceImpl extends PmsBaseServiceImpl implements IComLog4ceBizLogInfoService {

	private IComLog4ceBizLogInfoDao comLog4ceBizLogInfoDao;


	public Page queryComLog4ceBizLogInfo(ComLog4ceBizLogInfoVO comLog4ceBizLogInfoVO) {
		// TODO Auto-generated method stub

		Page page = comLog4ceBizLogInfoDao.queryComLog4ceBizLogInfo(comLog4ceBizLogInfoVO);
		page.setResult(comLog4ceBizLogInfoDOToVO(page.getResult()));
		List <ComLog4ceBizLogInfoVO> list=page.getResult();

		return page;
	}



	/**
	 * 功能描述:批量将Domain转换为VO<br>
	 * @param domainlist
	 * @return
	 * Create author:gaosong <br>
	 * Create on:2008-10-7  <br>
	 */
	private List<ComLog4ceBizLogInfoVO> comLog4ceBizLogInfoDOToVO(List<ComLog4ceBizLogInfoDomain> domainlist){
		if(domainlist == null || domainlist.size() == 0) return null;
		List<ComLog4ceBizLogInfoVO> voList = new ArrayList<ComLog4ceBizLogInfoVO>();
		for(Iterator<ComLog4ceBizLogInfoDomain> iterator = domainlist.iterator(); iterator.hasNext();){
			voList.add(comLog4ceBizLogInfoDOToVO(iterator.next()));
		}
		return voList;
	}

	/**
	 * 功能描述:转换单个domain为VO<br>
	 * @param domain
	 * @return
	 * Create author:gaosong <br>
	 * Create on:2008-10-7  <br>
	 */
	private ComLog4ceBizLogInfoVO comLog4ceBizLogInfoDOToVO(ComLog4ceBizLogInfoDomain domain){
		if(domain == null) return null;
		ComLog4ceBizLogInfoVO vo = new ComLog4ceBizLogInfoVO();
		vo.setOperator(domain.getOperator());
		vo.setClientAddress(domain.getClientAddress());

		vo.setOperatingTime(new SimpleDateFormat("yyyy-MM-dd HH:mm").format(domain.getOperatingTime()));
		vo.setOperation(domain.getOperation());
		vo.setBizDescription(domain.getBizDescription());

		return vo;
	}



	/**
	 * @return the comLog4ceBizLogInfoDao
	 */
	public IComLog4ceBizLogInfoDao getComLog4ceBizLogInfoDao() {
		return comLog4ceBizLogInfoDao;
	}



	/**
	 * @param comLog4ceBizLogInfoDao the comLog4ceBizLogInfoDao to set
	 */
	public void setComLog4ceBizLogInfoDao(
			IComLog4ceBizLogInfoDao comLog4ceBizLogInfoDao) {
		this.comLog4ceBizLogInfoDao = comLog4ceBizLogInfoDao;
	}



	public List readProperties() {
		// TODO Auto-generated method stub
		return comLog4ceBizLogInfoDao.readProperties();
	}


}
